home *** CD-ROM | disk | FTP | other *** search
/ Java for 3D & VRML Worlds / Java for 3d and VRML Worlds.iso / world / blur / blur.java < prev    next >
Text File  |  1996-10-17  |  1KB  |  81 lines

  1. // "Simple Blur Effect" with one blur object
  2.  
  3. //     created by ask@krc.sony.co.jp (Masamichi zzzcat Asukai)
  4.  
  5. //
  6.  
  7. // Copyright(C) 1996 Sony Corporation. All rights reserved.
  8.  
  9. //
  10.  
  11.  
  12.  
  13. import vrml.*;
  14.  
  15. import vrml.node.*;
  16.  
  17. import vrml.field.*;
  18.  
  19.  
  20.  
  21. public class blur extends Script {
  22.  
  23.  
  24.  
  25.     private SFVec3f setTranslation;
  26.  
  27.  
  28.  
  29.     private float[] translation = new float[3];
  30.  
  31.  
  32.  
  33.     private Node realobj;
  34.  
  35.  
  36.  
  37.     // constructor
  38.  
  39.     public void initialize() {
  40.  
  41.     setTranslation = (SFVec3f)getEventOut("setTranslation");
  42.  
  43.  
  44.  
  45.     realobj = (Node)((SFNode)getField("realobj")).getValue();
  46.  
  47.  
  48.  
  49.     // get translation of real object
  50.  
  51.     ((SFVec3f)realobj.getExposedField("translation")).getValue(translation);
  52.  
  53.     }
  54.  
  55.     
  56.  
  57.     public void processEvent(Event e) {
  58.  
  59.     if (e.getName().equals("interval")) {
  60.  
  61.         // set translation of blur object
  62.  
  63.             setTranslation.setValue(translation);
  64.  
  65.  
  66.  
  67.         // get translation of real object
  68.  
  69.         ((SFVec3f)realobj.getExposedField("translation")).getValue(translation);
  70.  
  71.         }
  72.  
  73.     }
  74.  
  75. }
  76.  
  77.  
  78.  
  79.  
  80.  
  81.